<?php
	include '../ini.php';
	include '../../libraries/xl_loai_san_pham.php';
	$dt_xl_loai_san_pham=new xl_loai_san_pham;
	/*
	function in_ten_loai_san_pham($ds_loai_san_pham, $ma, $kytu)
	{
		foreach($ds_loai_san_pham as $loai_san_pham)
		{
			if($loai_san_pham['ma_loai_cha']==$ma)
			{
				echo '<option value="'.$loai_san_pham['ma'].'">'.$kytu.$loai_san_pham['ten'].'</option>';
				in_ten_loai_san_pham($ds_loai_san_pham, $loai_san_pham['ma'], $kytu.$kytu);
			}
		}
	}*/
	function in_ten_loai_san_pham_cha($ds_loai_san_pham, $ma, $kytu)
	{
		foreach($ds_loai_san_pham as $loai_san_pham)
		{
			if($loai_san_pham['ma_loai_cha']==$ma)
			{
				echo '<option value="'.$loai_san_pham['ma'].'">'.$kytu.$loai_san_pham['ten'].'</option>';
			}
		}
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include'../widgets/js_css.php'?>
</head>
<body>
<div id="body-wrapper"> <!-- Wrapper for the radial gradient background -->
  
  <?php include '../widgets/sidebar.php'?>
  <div id="main-content"> <!-- Main Content Section with everything -->
  <!--noscript-->
    
    <!-- Page Head --> 
    <!-- End .shortcut-buttons-set -->
    
    <div class="clear"></div>
    <!-- End .clear -->
    
    <div class="content-box"><!-- Start Content Box -->
      
      <div class="content-box-header">
        <h3>Thêm loại sản phẩm</h3>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      
      <div class="content-box-content">
        <div id="tab2" class="tab-content default-tab" style="display: block;"> 
          <!-- Start Notifications --> 
          <!-- End Notifications -->
          <?php thong_bao()?>
          <form action="them_sm.php" name="f2" method="post" onsubmit="return kiem_tra()">
            <table border="0" width="100%">
              <tbody>
                <tr class="alt-row">
                  <td>Tên Loại</td>
                  <td><input type="text" id="ten" name="ten" size="70" value="<?php echo $_SESSION['ten']; $_SESSION['ten']='';?>"></td>
                </tr>
                <tr>
                  <td>Tên Loai Cha</td>
                  <td><select name="ma_loai_cha">
                      <option id="ma_loai_cha" name="ma_loai_cha" value="0" style="text-align: center;">----- No Parent -----</option>
                      <?php
						$ds_loai_san_pham=$dt_xl_loai_san_pham->danh_sach_all();
                        in_ten_loai_san_pham_cha($ds_loai_san_pham,0,'==');
                    ?>
                    </select></td>
                </tr>
                <tr class="alt-row">
                  <td>Thứ Tự Hiển Thị</td>
                  <td><input type="text" id="thu_tu_hien_thi" name="thu_tu_hien_thi" value="<?php echo $_SESSION['thu_tu_hien_thi']; $_SESSION['thu_tu_hien_thi']='';?>" size="70"></td>
                </tr>
                <tr>
                  <td>Mô tả</td>
                  <td><textarea class="text-input textarea wysiwyg" id="mo_ta" value="<?php echo $_SESSION['mo_ta']; $_SESSION['mo_ta']='';?>" name="mo_ta"></textarea></td>
                </tr>
                <tr>
                  <td colspan="2" style="text-align: center ! important;"><input type="submit" name="luu_va_thoat" value="Lưu Và Thoát" class="button">
                    <input type="submit" name="luu_va_tiep_tuc" value="Lưu Và Tiếp Tục" class="button">
                    <input type="button" onclick="window.location.href='danh_sach.php'" value="Không lưu" class="button"></td>
                </tr>
              </tbody>
            </table>
          </form>
        </div>
        <!-- End #tab2 --> 
        
      </div>
      <!-- End .content-box-content --> 
      
    </div>
    <!-- End .content-box -->
    
    <div class="clear"></div>
    <div id="footer"> <small> <!-- Remove this notice or replace it with whatever you want -->
    <!-- End #footer --> 
    
  </div>
  <!-- End #main-content --> 
</div>
</body>
</html>
